# coding:utf-8
from typing import List

class Solution:
    def checkStraightLine(self, coordinates: List[List[int]]) -> bool:
        if len(coordinates) == 0:
            return False
        elif len(coordinates) == 1:
            return True
        else:
            y0 = coordinates[0][1]
            x0 = coordinates[0][0]
            # 先计算斜率再依次判断是否在一条直线上
            if (coordinates[1][0] - coordinates[0][0]) == 0:
                for tmp in coordinates[2:]:
                    if tmp[0] != x0:
                        return False
                return True

            r = (coordinates[1][1] - coordinates[0][1]) / (coordinates[1][0] - coordinates[0][0])
            
            
            for tmp in coordinates[2:]:
                if tmp[1] - y0 != r * (tmp[0] - x0):
                    return False
                else:
                    continue
            return True   
                


if __name__ == '__main__':
    solu = Solution()
    res = solu.checkStraightLine([[1,2],[2,3],[3,4],[4,5],[5,6],[6,7]])
    print(res)
    